//
//  ViewController.swift
//  test
//
//  Created by Reeves Goo on 16/2/27.
//  Copyright © 2016年 ReevesGoo. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
       
        
        loadData { (html) -> () in
            print(html)
        }
        
        print("fhdkafskdahfksdhfksd")
        
         print("fhdkafskdahfksdhfksd")
        
         print("fhdkafskdahfksdhfksd")
    }

  
    
    func loadData(finish: (html:String)->()) {
    
        dispatch_async(dispatch_get_global_queue(0, 0)) { () -> Void in
            print("耗时操作\(NSThread.currentThread())")
            
            dispatch_sync(dispatch_get_main_queue(), { () -> Void in
                print("主线程更新UI\(NSThread.currentThread())")
            })
            
//            finish(html: "hello")
            
            
        }
    
    
    }
    
}

